const templateSettings = {
    evaluate: /\{\{(.+?)\}\}/g,
    interpolate: /\{\{=(.+?)\}\}/g,
    escape: /\{\{-(.+?)\}\}/g
};


var convertObjToQuery = function (obj) {
    let res = [];
    for (let k in obj) {
        let v = obj[k];
        if (v.constructor === Array) {
            v.forEach((d, i, f) => {
                res.push(encodeURIComponent(k) + "=" + encodeURIComponent(d));
            });
        } else {
            res.push(encodeURIComponent(k) + '=' + encodeURIComponent(v));
        }
    }
    return res.join('&');
}

var setUrl = function (url, obj) {
    return encodeURI(url + '?' + convertObjToQuery(obj));
}

var getUrlParams = function () {
    let args = {};
    let query = decodeURI(location.search.substring(1));
    let pairs = query.split('&');
    for (let i = 0; i < pairs.length; i += 1) {
        let pos = pairs[i].indexOf('=');
        if (pos !== -1) {
            let argName = decodeURIComponent(pairs[i].substring(0, pos));
            args[argName] = decodeURIComponent(pairs[i].substring(pos + 1));
        }
    }
    return args;
};

const RootURL = $('#RootURL').val();
const SessionUserId = $('#SessionUserId').val();

// console.log(RootURL);
// console.log(SessionUserId);